{"ast":null,"code":"import * as React from 'react';\nimport { getValue } from \"../utils/miscUtil\";\nimport { isSameDate, getQuarter } from \"../utils/dateUtil\";\nexport default function useRangeDisabled(_ref, disabledStart, disabledEnd) {\n  var picker = _ref.picker,\n    locale = _ref.locale,\n    selectedValue = _ref.selectedValue,\n    disabledDate = _ref.disabledDate,\n    disabled = _ref.disabled,\n    generateConfig = _ref.generateConfig;\n  var startDate = getValue(selectedValue, 0);\n  var endDate = getValue(selectedValue, 1);\n  function weekFirstDate(date) {\n    return generateConfig.locale.getWeekFirstDate(locale.locale, date);\n  }\n  function monthNumber(date) {\n    var year = generateConfig.getYear(date);\n    var month = generateConfig.getMonth(date);\n    return year * 100 + month;\n  }\n  function quarterNumber(date) {\n    var year = generateConfig.getYear(date);\n    var quarter = getQuarter(generateConfig, date);\n    return year * 10 + quarter;\n  }\n  var disabledStartDate = React.useCallback(function (date) {\n    if (disabledDate && disabledDate(date)) {\n      return true;\n    } // Disabled range\n\n    if (disabled[1] && endDate) {\n      return !isSameDate(generateConfig, date, endDate) && generateConfig.isAfter(date, endDate);\n    } // Disabled part\n\n    if (disabledStart && endDate) {\n      switch (picker) {\n        case 'quarter':\n          return quarterNumber(date) > quarterNumber(endDate);\n        case 'month':\n          return monthNumber(date) > monthNumber(endDate);\n        case 'week':\n          return weekFirstDate(date) > weekFirstDate(endDate);\n        default:\n          return !isSameDate(generateConfig, date, endDate) && generateConfig.isAfter(date, endDate);\n      }\n    }\n    return false;\n  }, [disabledDate, disabled[1], endDate, disabledStart]);\n  var disabledEndDate = React.useCallback(function (date) {\n    if (disabledDate && disabledDate(date)) {\n      return true;\n    } // Disabled range\n\n    if (disabled[0] && startDate) {\n      return !isSameDate(generateConfig, date, endDate) && generateConfig.isAfter(startDate, date);\n    } // Disabled part\n\n    if (disabledEnd && startDate) {\n      switch (picker) {\n        case 'quarter':\n          return quarterNumber(date) < quarterNumber(startDate);\n        case 'month':\n          return monthNumber(date) < monthNumber(startDate);\n        case 'week':\n          return weekFirstDate(date) < weekFirstDate(startDate);\n        default:\n          return !isSameDate(generateConfig, date, startDate) && generateConfig.isAfter(startDate, date);\n      }\n    }\n    return false;\n  }, [disabledDate, disabled[0], startDate, disabledEnd]);\n  return [disabledStartDate, disabledEndDate];\n}","map":{"version":3,"names":["React","getValue","isSameDate","getQuarter","useRangeDisabled","_ref","disabledStart","disabledEnd","picker","locale","selectedValue","disabledDate","disabled","generateConfig","startDate","endDate","weekFirstDate","date","getWeekFirstDate","monthNumber","year","getYear","month","getMonth","quarterNumber","quarter","disabledStartDate","useCallback","isAfter","disabledEndDate"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/rc-picker/es/hooks/useRangeDisabled.js"],"sourcesContent":["import * as React from 'react';\nimport { getValue } from \"../utils/miscUtil\";\nimport { isSameDate, getQuarter } from \"../utils/dateUtil\";\nexport default function useRangeDisabled(_ref, disabledStart, disabledEnd) {\n  var picker = _ref.picker,\n      locale = _ref.locale,\n      selectedValue = _ref.selectedValue,\n      disabledDate = _ref.disabledDate,\n      disabled = _ref.disabled,\n      generateConfig = _ref.generateConfig;\n  var startDate = getValue(selectedValue, 0);\n  var endDate = getValue(selectedValue, 1);\n\n  function weekFirstDate(date) {\n    return generateConfig.locale.getWeekFirstDate(locale.locale, date);\n  }\n\n  function monthNumber(date) {\n    var year = generateConfig.getYear(date);\n    var month = generateConfig.getMonth(date);\n    return year * 100 + month;\n  }\n\n  function quarterNumber(date) {\n    var year = generateConfig.getYear(date);\n    var quarter = getQuarter(generateConfig, date);\n    return year * 10 + quarter;\n  }\n\n  var disabledStartDate = React.useCallback(function (date) {\n    if (disabledDate && disabledDate(date)) {\n      return true;\n    } // Disabled range\n\n\n    if (disabled[1] && endDate) {\n      return !isSameDate(generateConfig, date, endDate) && generateConfig.isAfter(date, endDate);\n    } // Disabled part\n\n\n    if (disabledStart && endDate) {\n      switch (picker) {\n        case 'quarter':\n          return quarterNumber(date) > quarterNumber(endDate);\n\n        case 'month':\n          return monthNumber(date) > monthNumber(endDate);\n\n        case 'week':\n          return weekFirstDate(date) > weekFirstDate(endDate);\n\n        default:\n          return !isSameDate(generateConfig, date, endDate) && generateConfig.isAfter(date, endDate);\n      }\n    }\n\n    return false;\n  }, [disabledDate, disabled[1], endDate, disabledStart]);\n  var disabledEndDate = React.useCallback(function (date) {\n    if (disabledDate && disabledDate(date)) {\n      return true;\n    } // Disabled range\n\n\n    if (disabled[0] && startDate) {\n      return !isSameDate(generateConfig, date, endDate) && generateConfig.isAfter(startDate, date);\n    } // Disabled part\n\n\n    if (disabledEnd && startDate) {\n      switch (picker) {\n        case 'quarter':\n          return quarterNumber(date) < quarterNumber(startDate);\n\n        case 'month':\n          return monthNumber(date) < monthNumber(startDate);\n\n        case 'week':\n          return weekFirstDate(date) < weekFirstDate(startDate);\n\n        default:\n          return !isSameDate(generateConfig, date, startDate) && generateConfig.isAfter(startDate, date);\n      }\n    }\n\n    return false;\n  }, [disabledDate, disabled[0], startDate, disabledEnd]);\n  return [disabledStartDate, disabledEndDate];\n}"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,QAAQ,mBAAmB;AAC5C,SAASC,UAAU,EAAEC,UAAU,QAAQ,mBAAmB;AAC1D,eAAe,SAASC,gBAAgB,CAACC,IAAI,EAAEC,aAAa,EAAEC,WAAW,EAAE;EACzE,IAAIC,MAAM,GAAGH,IAAI,CAACG,MAAM;IACpBC,MAAM,GAAGJ,IAAI,CAACI,MAAM;IACpBC,aAAa,GAAGL,IAAI,CAACK,aAAa;IAClCC,YAAY,GAAGN,IAAI,CAACM,YAAY;IAChCC,QAAQ,GAAGP,IAAI,CAACO,QAAQ;IACxBC,cAAc,GAAGR,IAAI,CAACQ,cAAc;EACxC,IAAIC,SAAS,GAAGb,QAAQ,CAACS,aAAa,EAAE,CAAC,CAAC;EAC1C,IAAIK,OAAO,GAAGd,QAAQ,CAACS,aAAa,EAAE,CAAC,CAAC;EAExC,SAASM,aAAa,C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